<?php
defined('IN_ADMIN') or exit('No permission resources.');
include $this->admin_tpl('header','admin');
?>
<form name="searchform" action="?m=ushop&c=orders&a=order_list&menuid=<?php echo $_GET['menuid'];?>" method="post"  style="margin:10px auto; width:99%;">
<table width="100%" cellspacing="0" class="search-form">
    <tr>
    <td>
    <div class="explain-col" style="text-align:left;">
        <?php echo L('订单号')?>:<input type="text" value="" class="input-text" name="search[order_number]">
        <?php echo L('订单状态')?>:<?php echo form::select($orders_status,NULL,'name="search[order]"', L('all'))?>&nbsp;
        下单时间: <?php echo form::date('search[start_time]','','')?><?php echo L('to')?> <?php echo form::date('search[end_time]','','')?>      
        <input type="submit" value="<?php echo L('search')?>" class="button" name="dosubmit">
    </div>
    </td>
    </tr>
</table>
</form>
<form action="?m=ushop&c=orders&a=sale_order&menuid=<?php echo $_GET['menuid'];?>" method="post" id="sale_form">
<div class="table-list" style="width:99%; margin:auto;">
<table width="100%" cellspacing="0">
    <tr>
        <th width="35" align="center"><input type="checkbox" value="" id="check_box" onclick=""></th>
        <th width="15%" align="center">订单号&nbsp;
            <a href="javascript:alse_sort('order_sn','desc')"><img src="<?php echo IMG_PATH ;?>admin_img/sort_desc.gif" /></a>&nbsp;
            <a href="javascript:alse_sort('order_sn','asc')"><img src="<?php echo IMG_PATH ;?>admin_img/sort_asc.gif" /></a>
        </th>
        <th width="15%" align="center">下单时间&nbsp;
            <a href="javascript:alse_sort('shipping_time','desc')"><img src="<?php echo IMG_PATH ;?>admin_img/sort_desc.gif" /></a>&nbsp;
            <a href="javascript:alse_sort('shipping_time','asc')"><img src="<?php echo IMG_PATH ;?>admin_img/sort_asc.gif" /></a>
        </th>
        <th width='15%' align="center">总金额&nbsp;
            <a href="javascript:alse_sort('goods_amount','desc')"><img src="<?php echo IMG_PATH ;?>admin_img/sort_desc.gif" /></a>&nbsp;
            <a href="javascript:alse_sort('goods_amount','asc')"><img src="<?php echo IMG_PATH ;?>admin_img/sort_asc.gif" /></a>
        </th>
        <th width="13%" align="center">收货人</th>
        <input type="hidden" name="search_order" value="" id="search_order" />
        <input type="hidden" name="infos" value="<?php echo $where; ?>" />
        <th width="13%" align="center">订单状态</th>
        <th width="15%" align="center">操作</th>
    </tr>
<?php
if(is_array($infos) && !empty($infos)){
	foreach($infos as $info){
?>
	<tr>
		<td align="center"><input type="checkbox" name="mid[]" value="<?php echo $info['order_id']?>"></td>
        <td align="center" widht="15%"><?php echo $info['order_sn'];?></td>
		<td align="center" widht="35%"><?php echo date('Y-m-d h:i:s',$info['shipping_time']);?></td>
        <td align="center" width="10%">￥<?php echo $info['goods_amount'];?></td>
		<td align="center" width="10%"><?php echo $info['consignee_name'];?></td>
        <td align="center" width="10%"><?php echo $info['order_status']."&nbsp;&nbsp;&nbsp;&nbsp;".$info['shipping_status']."&nbsp;&nbsp;&nbsp;&nbsp;".$info['pay_status'];?></td>
        <td align="center" width="10%">
        <a href="index.php?m=ushop&c=orders&a=order_info&order_id=<?php echo $info['order_id']; ?>&menuid=<?php echo $_GET['menuid'];?>">查看</a>
        </td>
	</tr>
	<?php
	}
}elseif(empty($infos)) {
?>
	<tr>
    	<td colspan="7" align="center">暂时还没有数据</td>
    </tr>
<?php
}
?>
</table>
</div>
<div class="btn">
    <a href="#" onClick="javascript:$('input[type=checkbox]').attr('checked', true)"><?php echo L('selected_all')?></a>/
    <a href="#" onClick="javascript:$('input[type=checkbox]').attr('checked', false)"><?php echo L('cancel')?></a>
    <input name="dosubmit" type="submit" class="button" value="删除选中" onclick="return confirm('<?php echo L('confirm', array('message' => L('selected')))?>');">&nbsp;&nbsp;
</div>
<div id="pages"><?php echo $pages?></div>
</form>
<script>
	$("input[value='删除选中']").live('mousedown',function() {
		document.getElementById("sale_form").action = "?m=ushop&c=orders&a=sale_del";
	})
	function alse_sort(sort_by,sort_order) {
		document.getElementById('search_order').value = sort_by+'&'+sort_order;
		document.getElementById('sale_form').submit();
	}
</script>
</body>
</html>